package business.impl;

import java.sql.ResultSet;
import java.util.List;

import model.AnnexB;
import model.TPractice;
import model.TStuchi;
import model.VStuachi;
import business.basic.iHibBaseDAO;
import business.basic.iHibBaseDAOImpl;
import business.dao.StuachiDao;

public class StuchiDaoIpml implements StuachiDao {
	
	
	iHibBaseDAO bdao = null;
	public void setBdao (iHibBaseDAO bdao){
		this.bdao=bdao;
		
	}

	@Override
	public TStuchi getstuchiById(int id) {
		TStuchi title = (TStuchi) bdao.findById(TStuchi.class,id);
		return title;
	}

	@Override
	public int addPhoto(TStuchi model) {
		Object obj = bdao.insert(model);
		if (obj == null) {
			return 0;
		}
		return 1;
	}

	@Override
	public boolean upPhoto(TStuchi model) {
		return bdao.update(model);
	}

	@Override
	public boolean delStuchi(int id) {
		return bdao.delete(TStuchi.class, id);
	}

	@Override
	public List<VStuachi> getStuchis(int stuid) {
		String sql = " from VStuachi where stuinfoid =   ?";
		Object[] para = {stuid};
		List<VStuachi> modl = bdao.select(sql, para);
		return modl;
	}

	@Override
	public VStuachi getVstuchiById(int id) {
		VStuachi title = (VStuachi)bdao.findById(VStuachi.class,id);
		return title;
	}

}
